package com.xzl.org.learning_situation_analysis.service.Impl;

import com.xzl.org.learning_situation_analysis.dao.AnalysisMapper;
import com.xzl.org.learning_situation_analysis.entity.Analysis.AggregateAnalysis;
import com.xzl.org.learning_situation_analysis.entity.Analysis.ClazzAnalysis;
import com.xzl.org.learning_situation_analysis.entity.Analysis.TotalScoreAnalysis;
import com.xzl.org.learning_situation_analysis.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 夏智力
 * @FileName AnalysisServiceImpl
 * @date 2022/4/15 16:35
 * @Software: IntelliJ IDEA
 */
@Service
public class AnalysisServiceImpl implements AnalysisService {

    @Autowired
    private AnalysisMapper analysisMapper;

    @Override
    public List<TotalScoreAnalysis> selectByKnowledgePoints(int paperId, int studentId) {
        return analysisMapper.selectByKnowledgePoints(paperId, studentId);
    }

    @Override
    public List<TotalScoreAnalysis> selectByQuestionType(int paperId, int studentId) {
        return analysisMapper.selectByQuestionType(paperId, studentId);
    }

    /*
    * 计算班级题目最高（低）分、平均分
    * */
    @Override
    public List<AggregateAnalysis> selectAggregateByPaperId(int paperId) {
        return analysisMapper.selectAggregateByPaperId(paperId);
    }

    /*
     * 计算班级题目得分率
     * */
    @Override
    public float selectByQuestionIdAndClazzId(int questionId, int clazzId) {
        return analysisMapper.selectByQuestionIdAndClazzId(questionId, clazzId);
    }

    /*
     * 计算班级题型相关信息
     * */
    @Override
    public List<ClazzAnalysis> selectClazzByTargetType(String targetType) {
        return analysisMapper.selectClazzByTargetType(targetType);
    }

    @Override
    public List<ClazzAnalysis> selectClazzByPaperId(int paperId) {
        return analysisMapper.selectClazzByPaperId(paperId);
    }



    @Override
    public List<AggregateAnalysis> selectAggregateByPaperIdInGrade(int paperId) {
        return analysisMapper.selectAggregateByPaperIdInGrade(paperId);
    }

    @Override
    public float selectByQuestionIdAndGradeIdInGrade(int questionId, int GradeId) {
        return analysisMapper.selectByQuestionIdAndGradeIdInGrade(questionId, GradeId);
    }

    @Override
    public List<ClazzAnalysis> selectClazzByTargetTypeInGrade(String targetType) {
        return analysisMapper.selectClazzByTargetTypeInGrade(targetType);
    }

    @Override
    public List<ClazzAnalysis> selectClazzByPaperIdInGrade(int paperId) {
        return analysisMapper.selectClazzByPaperIdInGrade(paperId);
    }

}
